﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using web.data.entities;
using web.bussines;
using Webdiyer.WebControls.Mvc;
using System.Web.UI;
using web.core.Controllers;

namespace web.core.Models
{
    public class transModels
    {
        //get all get all
        public static PagedList<translate> translate_plist(int pageindex, int pagesize, int language_id, int groupid)
        {
            var obj = new translate_service();
            return obj.translate_plist(pageindex, pagesize, language_id, groupid);
        }

        //get list translate, to create xml file
        public static Dictionary<string, string> get_list_trans(int groupid, int language_id)
        {
            var obj = new translate_service();
            var dict = new Dictionary<string, string>();
            var lst = obj.get_list_trans(groupid, language_id);
            foreach(var it in lst){
                dict.Add(it.trans_label, it.trans_text);
            }
            return dict;
        }

        public static long trans_update(translate it)
        {
            var obj = new translate_service();
            return obj.trans_update(it);
        }

        //get items by id or code
        public static translate getByID(string lbl, int groupid, int langid)
        {
            var obj = new translate_service();
            return obj.getByID(lbl, groupid, langid);
        }

        public static List<translate> ListByLbl(string lbl, int groupid)
        {
            var obj = new translate_service();
            return obj.ListByLbl(lbl, groupid);
        }
    }
}